package controller;

import com.whf.vo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lmpl.UserService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
@Api(value="用户管理",tags="用户管理")
@CrossOrigin
public class UserController {
    @Resource
    private UserService userService;
    //    注册
    @ApiOperation("用户注册接口")
    @ApiImplicitParams({
            @ApiImplicitParam(dataType = "string",name = "userName",value = "用户注册账号",required = true),
            @ApiImplicitParam(dataType = "string",name = "password",value = "用户注册密码",required = true)
    })
    @PostMapping(value = "/regist")
    public ResultVO userRegist(String userName, String password){
        return userService.userRegist(userName,password);
    }
    //    登陆
    @ApiOperation(value = "用户登录接口")
    @ApiImplicitParams({
            @ApiImplicitParam(dataType = "string",name = "userName",value = "用户登录账号",required = true),
            @ApiImplicitParam(dataType = "string",name = "password",value = "用户登录密码",required = true)
    })
    @GetMapping(value = "/login")
    public ResultVO userLogin(String userName, String password){
        return userService.userLogin(userName,password);
    }
//    public List<User> getUser(){
//        return null;
//    }
}
